<?php
namespace app\admin\controller;

use think\Loader;

class Business extends Common {

    protected $name = 'business_assess';

    public function _initialize(){

        $this->business = new \app\admin\model\Business();
    }

    public function index() {

        $lists = null;
        $lists = $this->business->businessList(['status'=>5]);
        $this->assign('lists', $lists);
        return $this->fetch();
    }

    //删除
    public function del() {

        $data = input();
        $this->business->delStockBusiness($data['sid'], $data['stock_code'],['status'=>$data['status']]);
        $this->success('操作成功', url('index'));
    }

    //编辑
    public function editp() {

        $data = input();
        $reVal= [];
        $reVal= $this->business->businessDetail(['sid'=>$data['sid']]);
        $reVal['sid']= $data['sid'];
        $reVal['stock_code']= $data['stock_code'];
        $this->assign('detail', $reVal);
        return $this->fetch();
    }

    public function edit() {

        $data = input();
        $this->business->edit($data);
        $this->success('操作成功', url('index'));
    }
}